/*
 * @Author: 半生瓜 1515706227@qq.com
 * @Date: 2024-04-21 17:20:21
 * @LastEditors: 半生瓜 1515706227@qq.com
 * @LastEditTime: 2024-05-17 11:20:19
 * @FilePath: \vue-element-plus-admin-mini\src\api\login\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/axios'
import type { UserType } from './types'

interface RoleParams {
  roleName: string
}

export const loginApi = (data): Promise<IResponse> => {
  return request.post({ url: '/jwt/token', data })
}

export const loginOutApi = (): Promise<IResponse> => {
  return request.get({ url: '/mock/user/loginOut' })
}

export const getAdminRoleApi = (): Promise<IResponse<AppCustomRouteRecordRaw[]>> => {
  return request.post({ url: '/user/authList' })
}

export const getTestRoleApi = (params: RoleParams): Promise<IResponse<string[]>> => {
  return request.get({ url: '/mock/role/list2', params })
}

export const getRsaKey = (): Promise<IResponse> => {
  return request.post({ url: '/encrypt/rsaKey' })
}
//获取登录用户信息
export const getuesrinfo = (): Promise<IResponse> => {
  return request.post({ url: '/user/v1/detail' })
}
//获取刷新token

export const getRefreshToken = (data: any): Promise<IResponse> => {
  return request.post({ url: '/jwt/refreshToken', data })
}
